treeview: Remove special cases when computing parity
authorBenjamin Otte <otte@redhat.com>
Thu, 7 Jul 2011 06:47:25 +0000 (08:47 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 16 Nov 2011 03:31:06 +0000 (04:31 +0100)
The parity of the nil npode is always 0, so no need to check for the nil
node first.

gtk/gtkrbtree.c

index b351eb7fc3ffa74a2253262612072e9f91665abc..a912530779473d839aeacf0aa390751421925847 100644 (file)
@@ -1489,9 +1489,8 @@ void _fixup_parity (GtkRBTree *tree,
                    GtkRBNode *node)
 {
   node->parity = 1 +
-    ((node->children != NULL && node->children->root != node->children->nil) ? node->children->root->parity : 0) + 
-    ((node->left != tree->nil) ? node->left->parity : 0) + 
-    ((node->right != tree->nil) ? node->right->parity : 0);
+    (node->children != NULL ? node->children->root->parity : 0) + 
+    node->left->parity + node->right->parity;
 }
 
 #ifdef G_ENABLE_DEBUG